<?php
namespace ProjetA\GroupeBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of TextType
 *
 * @author Gael
 */
class DateType extends AbstractType {
    protected $name;
    protected $value;
    function __construct($name, $value= null) {
        $this->name = $name;
        $this->value= $value;
    }
    
    public function buildForm(FormBuilder $builder, array $options)
    {
            if($this->value){
                $builder->add($this->name,'date',array('empty_value' => array('year' => $this->value->format('Y'), 'month' => $this->value->format('m'), 'day' => $this->value->format('d'))));
            }else{
                $builder->add($this->name,'date',array('empty_value' => array('year' => 2012, 'month' => 1, 'day' => 1)));
            }
            
    }
    

    public function getName() {
        return 'projeta_groupebundle_texttype';
    }
}

?>
